import React from 'react'
import { Route, Switch, Redirect } from 'react-router-dom'
import LoadableComponent from '../../utils/LoadableComponent'


//参数一定要是函数，否则不会懒加载，只会代码拆分

//首页
const Home = LoadableComponent(() => import('../../module/controlPanel/home/home')) // 控制台-首页


//数据中心
const BarrierGateData = LoadableComponent(() => import('../../module/dataCentre/barrierGateData/barrierGateData')) // 数据中心-道闸数据
const WeightData = LoadableComponent(() => import ('../../module/dataCentre/weightData/weightData')) //数据中心-称重数据
const VehicleWhiteList = LoadableComponent(() => import('../../module/dataCentre/VehicleWhiteList/VehicleWhiteList'))  //数据中心-车辆白名单
const VehicleBlackList = LoadableComponent(() => import('../../module/dataCentre/VehicleBlackList/VehicleBlackList')) // 数据中心-车辆黑名单


//配置中心
const hardwareConfig = LoadableComponent(() => import('../../module/hardwareCenter/hardwareConfig/hardwareConfig')) // 配置中心-车辆黑名单
const programConfig = LoadableComponent(() => import('../../module/hardwareCenter/programConfig/programConfig')) // 配置中心-车辆黑名单
const SaasConfig = LoadableComponent(() => import('../../module/hardwareCenter/SaasConfig/SaasConfig')) // 配置中心-车辆黑名单
const NewProject = LoadableComponent(() => import('../../module/hardwareCenter/NewProject/NewProject')) // 配置中心-车辆黑名单
//设备库
const deviceList = LoadableComponent(() => import('../../module/deviceLibrary/deviceList/deviceList')) // 设备库-设备列表
const deviceBuy = LoadableComponent(() => import('../../module/deviceLibrary/deviceBuy/deviceBuy')) // 设备库-采购列表
const deviceBrand = LoadableComponent(() => import('../../module/deviceLibrary/deviceBrand/deviceBrand')) // 设备库-设备品牌
const addNewType = LoadableComponent(() => import('../../module/deviceLibrary/addNewType/addNewType')) // 设备库--设备列表-新增型号
const deviceInfo = LoadableComponent(() => import('../../module/deviceLibrary/deviceInfo/deviceInfo')) // 设备库--设备列表-设备详情/变更记录
const buyDetail = LoadableComponent(() => import('../../module/deviceLibrary/buyDetail/buyDetail')) // 设备库-采购详情
const addNewDevice = LoadableComponent(() => import('../../module/deviceLibrary/addNewDevice/addNewDevice')) // 设备库-采购录入
const DeviceBrandDetail = LoadableComponent(() => import('../../module/deviceLibrary/deviceBrandDetail/deviceBrandDetail/deviceBrandDetail')) // 设备库-设备品牌列表

// 账号管理
const autherAccount = LoadableComponent(() => import('../../module/auther/autherAccount/autherAccount')) // 账户管理
const autherCom = LoadableComponent(() => import('../../module/auther/autherCom/autherCom')) // 组织架构
const addNewAcc = LoadableComponent(() => import('../../module/auther/addNewAcc/addNewAcc'))//创建新账户
const editAcc = LoadableComponent(()=> import('../../module/auther/editAcc/editAcc'))//编辑
const accDetail =LoadableComponent(() => import('../../module/auther/accDetail/accDetail'))//详情

// 我的申报审批
const myDeclare = LoadableComponent(()=> import('../../module/myWork/myDeclare/myDeclare'))//编辑
const myReview =LoadableComponent(() => import('../../module/myWork/myReview/myReview'))//详情


// 我的账号
const myAccount = LoadableComponent(() => import('../../module/myAccount/myAccount'))//我的账户
class ContentMain extends React.Component {
   
    render () {
        return (
            <Switch>
                <Redirect exact from='/' to='/index/controlPanel/index'/>
                
                {/*首页*/}
                <Route exact path="/index/controlPanel/index" component={Home} />
                
                {/* 数据中心 */}
                <Route exact path="/index/dataCentre/barrierGateData" component={BarrierGateData} />
                <Route exact path="/index/dataCentre/weightData" component={WeightData} />
                <Route exact path="/index/dataCentre/VehicleWhiteList" component={VehicleWhiteList} />
                <Route exact path="/index/dataCentre/VehicleBlackList" component={VehicleBlackList} />
                
                {/* {配置中心} */}
                <Route exact path="/index/hardwareCenter/hardwareConfig" component={hardwareConfig} />
                <Route exact path="/index/hardwareCenter/programConfig" component={programConfig} />
                <Route exact path="/index/hardwareCenter/SaasConfig" component={SaasConfig} />
                <Route exact path="/index/hardwareCenter/programConfig/programConfigDetail/NewProject" component={NewProject} />
                
                
                {/* {设备库} */}
                <Route exact path="/index/deviceLibrary/deviceList" component={deviceList} />
                <Route exact path="/index/deviceLibrary/deviceBuy" component={deviceBuy} />
                <Route exact path="/index/deviceLibrary/deviceBrand" component={deviceBrand} />
                <Route exact path="/index/deviceLibrary/deviceList/addNewType" component={addNewType} />
                
                <Route exact path="/index/deviceLibrary/deviceList/deviceInfo" component={deviceInfo} />
                {/* <Route exact path="/index/myWork/myReview/deviceInfo" component={deviceInfo} /> */}

                <Route exact path="/index/deviceLibrary/deviceBuy/buyDetail" component={buyDetail} />
                <Route  exact path="/index/deviceLibrary/deviceBuy/addNewDevice" component = {addNewDevice} />
                <Route  exact path="/index/deviceLibrary/deviceBrandDetail/deviceBrandDetail/deviceBrandDetail" component = {DeviceBrandDetail} />
                {/* 账号管理 */}
                <Route  exact path="/index/auther/autherAccount" component = {autherAccount} />
                <Route  exact path="/index/auther/autherCom" component = {autherCom} />
                <Route  exact path='/index/auther/autherAccount/addNewAcc' component = {addNewAcc}  />
                <Route  exact path='/index/auther/autherAccount/editAcc' component = {editAcc}  />
                <Route exact path='/index/auther/autherAccount/accDetail' component = {accDetail} />

                {/* 我的账号 */}
                <Route  exact path='/index/myAccount/myAccount' component = {myAccount} />

                {/* 申报和审批 */}
                <Route  exact path='/index/myWork/myDeclare' component = {myDeclare} />
                <Route  exact path='/index/myWork/myReview' component = {myReview} />

            </Switch>
        )
    }
}

export default ContentMain

 